<template>
  <div class="setting-page">
    <el-card>
      <h2>系统设置</h2>
      <el-form :model="form" label-width="100px" class="setting-form">
        <el-form-item label="用户名">
          <el-input v-model="form.username" placeholder="请输入用户名"></el-input>
        </el-form-item>
        <el-form-item label="邮箱">
          <el-input v-model="form.email" placeholder="请输入邮箱"></el-input>
        </el-form-item>
        <el-form-item label="主题">
          <el-select v-model="form.theme" placeholder="请选择主题">
            <el-option label="亮色" value="light"></el-option>
            <el-option label="暗色" value="dark"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="saveSetting">保存设置</el-button>
          <el-button @click="resetForm">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'

const form = ref({
  username: '',
  email: '',
  theme: 'light'
})

function saveSetting() {
  // 这里可以调用接口保存设置
  ElMessage.success('设置已保存！')
}

function resetForm() {
  form.value = {
    username: '',
    email: '',
    theme: 'light'
  }
}
</script>

<style scoped>
.setting-page {
  max-width: 500px;
  margin: 40px auto;
}
.setting-form {
  margin-top: 20px;
}
</style>
